package com.project.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.project.bean.UserBean;
import com.project.dao.UserMapper;

import com.project.service.IUserService;

@Service(value = "userservice")
public class UserServiceImpl implements IUserService {

	@Autowired
	private UserMapper userdao;

	@Override
	public UserBean findUserByName(String name) {

		return userdao.findUserByName(name);
	}

	@Override
	public int registerUser(UserBean user) {
	
		return userdao.insert(user);
	}

	@Override
	public int updateGym(UserBean user) {
		// TODO Auto-generated method stub
		return userdao.updateByPrimaryKeySelective(user);
	}

	public UserBean findUserById(int id) {
		UserBean user=userdao.selectByPrimaryKey(id);
		return user;
	}
    
	@Override
	public int updateUserMessage(UserBean user) {
		
		return userdao.updateByPrimaryKeySelective(user);
	}

	@Override
	public int changeUserPassword(int UId, String npwd) {
		
		return userdao.changeUserPassword(UId, npwd);
	}

	@Override
	public int updateUserMessage(int UId, String uName, String uAddress, String img,Double x,Double y) {
		
		return userdao.updateUserMessage(UId, uName, uAddress, img,x,y);
	}

	@Override
	public List<UserBean> findUsersByType(int type) {
		// TODO Auto-generated method stub
		return userdao.findUserByType(type);
	}

}